﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;

namespace WpfApplication1
{
    [XmlRoot(ElementName = "iwb")]
    public class testModel
    {
        [XmlElement("svg", Namespace = "http://www.w3.org/2000/svg")]
        public string StrValue { get; set; }

        public string Url;

        public List<IWBElementBase> cont { get; set; }


        #region CDATA 示例
        [XmlIgnore]
        public string CDataContent { get; set; }

        [XmlElement("Content")]
        public XmlNode[] Nodes
        {
            get
            {
                var dom = new XmlDocument();
                return new XmlNode[] { dom.CreateCDataSection(this.CDataContent) };
            }
            set
            {
                if (value == null)
                {
                    this.CDataContent = null;
                    return;
                }

                if (value.Length != 1)
                    throw new InvalidOperationException("Invalid array.");
                var content = value[0];
                if (null == content)
                    throw new InvalidOperationException("Node is null.");
                this.CDataContent = content.Value;
            }
        }
        #endregion
    }
}
